
void game()
{
	//1.生成随机数
	int r = rand() % 100 + 1;

	//2.猜数字
	int guess = 0;
	int count = 5;//最多猜5次
	while (count)
	{
		printf("你还有%d次机会\n", count);
		printf("请猜数字:>");
		scanf("%d", &guess);
		if (guess < r)
			printf("猜小了\n");
		else if (guess > r)
			printf("猜大了\n");
		else
		{
			printf("恭喜你猜对了，随机数是: %d\n",r);
			break;
		}
		count--;
	}
	if (0 == count)
	{
		printf("机会使用完了，你失败了，正确的数字是:%d\n", r);
	}
}